<?php
/**
 * index.php
 *
 * momoger.com 应用程序入口文件.
 *
 * This source file is subject to the new BSD license that is bundled
 * with this package in the file LICENSE.txt.
 * It is also available through the world-wide-web at this URL:
 * http://momoger.com/license
 *
 * @author  	Guya
 * @version    	1.0
 * @copyright  	Copyright © 2009 www.momoger.com All Rights Reserved.
 * @license    	http://momoger.com/license     New BSD License
 */

//设定应用程序执行目录
defined ( 'APPLICATION_PATH' ) || define ( 'APPLICATION_PATH', realpath ( dirname ( __FILE__ ) . '/../application' ) );

//定义应用程序执行环境信息.
defined ( 'APPLICATION_ENV' ) || define ( 'APPLICATION_ENV', (getenv ( 'APPLICATION_ENV' ) ? getenv ( 'APPLICATION_ENV' ) : 'production') );

//定义系统配置信息保存名
defined ( 'APP_CONFIG' ) || define ( 'APP_CONFIG', 'momoger_config');

//定义文件上传地址, 请同时设定域名 upload.momoger.com 指向 UPLOAD_DIR
defined ( 'UPLOAD_DIR' ) || define ( 'UPLOAD_DIR', dirname(dirname(dirname(__FILE__))) . '/upload');

//设定类库载入目录
//set_include_path(implode(PATH_SEPARATOR, array( realpath ( dirname ( __FILE__ ) . '/../library'), get_include_path() )));
set_include_path(realpath ( dirname ( __FILE__ ) . '/../library'));

//创建应用程序对象, 设置环境信息. 执行应用程序.
require_once 'Zend/Application.php';
$_application = new Zend_Application ( APPLICATION_ENV , APPLICATION_PATH . '/configs/application.ini');

//保存系统配置文件.
Zend_Registry::set(APP_CONFIG, $_application->getOptions());

//runing
$_application->bootstrap()->run();